package com.kpiJavaTraining.bogdan.module2;

import java.io.IOException;
import java.util.ArrayList;

public class InitLearnQuestions {
	public ArrayList<LearnQuestion> initLearnQuestions() throws IOException, ClassNotFoundException, CloneNotSupportedException{
		InitQuestions t= new InitQuestions();
		ListOfNode<Question> temp= t.getQuestions();
		ArrayList<LearnQuestion> learnQuestions= new ArrayList<LearnQuestion>();
		initQuestionInLearnQuestions(learnQuestions,temp);
		initTopicAndDifficulty(learnQuestions);
		return learnQuestions;	
	}
	
	
	//Change Logic
	private void initTopicAndDifficulty(ArrayList<LearnQuestion> learnQuestions){
		for(LearnQuestion e:learnQuestions){
			new Printer().println(e);
			e.setTopic(new Reader().readLn());
			e.setDifficulty(new Reader().readInt());
		}
	}
	
	private void initQuestionInLearnQuestions(ArrayList<LearnQuestion> learnQuestions,ListOfNode<Question> temp){
		for(Question e:temp){
			learnQuestions.add(new LearnQuestion(e));
		}
	}
}
